package state;

public class ThreadContext {
    private ThreadState threadState;
    public ThreadContext(ThreadState initialState){
        this.threadState = initialState;
    }
    public ThreadState getThreadState() {
        return threadState;
    }
    public void setThreadState(ThreadState threadState) {
        this.threadState = threadState;
    }
    public void start(){
        ((NewState)threadState).start(this);
    }
    public void getCOU(){
        ((RunnableState)threadState).getCPU(this);
    }
    public void suspend(){
        ((RunningState)threadState).suspend(this);
    }
    public void stop(){
        ((RunningState)threadState).stop(this);
    }
    public void resume(){
        ((BlockedState)threadState).resume(this);
    }
}
